package org.teremail.schema;

/**
 * Dialect imlementation for the Derby database.
 * 
 * @author Michael Barker
 *
 */
public class DerbyDialect extends AbstractDialect {

    private final static DerbyDialect instance = new DerbyDialect();
    
    private DerbyDialect() {}
    
    public static Dialect getInstance() {
        return instance;
    }

    public String generateBinary(int length) {
        return "VARCHAR(" + length + ") FOR BIT DATA";
    }

    public String getInteger(int precision) {
        switch (precision) {
        case 2:
            return "SMALLINT";
        case 4:
            return "INTEGER";
        case 8:
            return "BIGINT";
        default:
            throw new RuntimeException("Precision: " + precision + " for integer not supported");
        }
    }
}
